/*
 * nmeRecArray.h
 *
 *  Created on: Jan 3, 2009
 *      Author: Carmine Red
 */

#ifndef NMERECARRAY_H_
#define NMERECARRAY_H_

#define MAX_ENEMIES 256		// max number of enemies allowed in struct

class nmeRecArray
{
private:
	int num_enemies;
							/* tracks num enemies in view MAY WANT TO MAKE ITS
							OWN UTILITY CLASS WITH NME_STATUS ARRAYS */

	int nme_ID[MAX_ENEMIES];
							/*array to hold enemy IDs*/

	bool nme_Status[MAX_ENEMIES];
									/*static array with a set limit for maximum
									enemies, tracks above/below status for enemies
									above == true, below == false*/

	bool nme_New[MAX_ENEMIES];
									/*static array that returns true if the enemy was
									just entered into the struct, otherwise returns false*/

	bool nme_Changed[MAX_ENEMIES];
											/*This array will be reset every update
											to false, but during the update, it will
											be used to return true for items who have
											changed their above/below status inside
											that update.*/

	/*possible future optimization: sorting this array*/

public:
	nmeRecArray();
	~nmeRecArray();

	int getIndexFromID(int id);		// return an index to the enemy with
									// this id, -1 if not found

	// may no longer need these
	bool setnmeNew(int id, bool value);
	bool getnmeNew(int id);			// returns true if not found
	// may no longer need these

	int getNumEnemies()	{return num_enemies;}

	int getnmeID(int index);	// gets id of enemy at index, -1 if out of bounds

	bool setnmeChanged(int id, bool value);
	bool getnmeChangedViaID(int id);		// gets changed status of enemy with this id
	bool getnmeChangedViaIndex(int index);	// gets changed status of enemy at this index

	bool setnmeAboveStatus(int id, bool value); /*above == true, below = false*/
	bool getnmeAboveStatus(int id);	// returns false if id not found

	bool addRecordnme(int id);	// returns false if no more space
								// otherwise, increments num_enemies, and uses the
								// 		given id, status is below(false),
								// 		New is true, changed is false

	bool removeViaID(int id);	// returns false if can't find id
								// otherwise switches record with the last record in the
								// array, decrements num_enemies by 1

	bool isInStruct(int id);	// returns true if the enemy has a record in the struct
								// else returns false
};

#endif /* NMERECARRAY_H_ */
